package tests;

import static org.junit.Assert.*;

import info.Conference;
import info.Manuscript;

import java.util.Date;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import users.ProgramChair;
import users.User;

/**
 * Junit test for the ProgramChiar class. 
 * @author Lun-Wei Chang
 * @version 3/19/2014
 */
public class ProgramChairTest {
  
  /** The program chair for testing purpose. */
  private ProgramChair my_pc; 
  
  /** The ID that this role is represented by. */
  private long my_role_id; 
  /** The conference that the Program Chair is responsible for. */
  private Conference my_conference;
  /** The list of Subprogram Chairs that the Program Chair has assigned. */
  private List<Long> my_subprogram_chairs;
  
  /** The list of manuscripts that the Program Chair has received for
   * review from the manuscript submissions. */
  private List<Long> my_manuscripts; 
  
  /** ProgramChiar's role name. */
  private String my_role_name;
  
  /** 
   * Initializes all variable for ProgramChairTest. 
   * @throws Exception 
   */
  @SuppressWarnings("deprecation")
  @Before
  public void setUp() throws Exception {
    final User user = new User("David", "Chang", "aspirine539@gmail.com");
    final Conference meeting = new Conference(0, "UW_CSE", 
                                        "Computer Engineering", new Date(2014, 03, 31));
    my_role_id = my_pc.getRoleID();
    my_pc = new ProgramChair(my_role_id, user, meeting);
    my_conference = my_pc.getConference();
    my_subprogram_chairs = my_pc.getSubprogramChairs();
    my_manuscripts = my_pc.getManuscripts();
    my_role_name = my_pc.getRoleName();
    
    
  }
  
  /** Tests the assignSubprogramChairRole method. */
  @Test
  public void assignSubprogramChairRole() {
    
  }
  
  /** Tests the assignManuscriptToSubprogramChair method. */
  @Test
  public void assignManuscriptToSubprogramChair() {
    
  }

  /** Tests the acceptManuscript method. */
  @Test
  public void acceptManuscript() {
    final Manuscript paper1 = new Manuscript(0, "", null, "", 0, 
                                             null, null, "", "", 0, null, 0);
    final Manuscript paper2 = new Manuscript(0, "", null, "", 0, 
                                                 null, null, "", "", 1, null, 0);
    assertTrue(my_pc.rejectManuscript(paper1));
    assertFalse(my_pc.rejectManuscript(paper2));
  }
  
  /** Tests the assignManuscript method. */
  @Test
  public void assignManuscript() {

  }
  
  /** Tests whether the PC can reject a manuscript. */
  @Test
  public void rejectManuscript() {
    final Manuscript paper1 = new Manuscript(0, "", null, "", 0, 
                                                null, null, "", "", 0, null, 0);
    final Manuscript paper2 = new Manuscript(0, "", null, "", 0, 
                                                null, null, "", "", 1, null, 0);
    assertTrue(my_pc.rejectManuscript(paper1));
    assertFalse(my_pc.rejectManuscript(paper2));
  }
  
  /** Checks if the getConference method returns a conference. */
  @Test
  public void getConference() {
    assertNotNull("Empty conference!", my_conference);
  }
  
  /** Checks if the getSPC method returns a SPC. */
  @Test
  public void getSubprogramChairs() {
    assertNotNull("Empty SPC!", my_subprogram_chairs);
  }
  
  /** Checks if the Manuscripts list is empty or not. */
  @Test
  public void getManuscripts() {
    assertNotNull("Empty Manuscript list!", my_manuscripts);
  }
  
  /** Checks if the Role ID is correct. */
  @Test
  public void getRoleID() {
    assertEquals("Incorrect role id!", 1, my_role_id);
  }
  
  /** Checks if the Role name is correct. */
  @Test
  public void getRoleName() {
    assertNotNull("Empty Name!", my_role_name);
    assertEquals("Incorrect role name!", "PC", my_role_name);
  }
}
